<?php
class Mproduct extends CI_Model{
	protected $_table="tpt_product";
	public function __construct(){
		parent::__construct();	
		$this->load->database();
	}

	public function showDetailProduct($id){
		$this->db->where('id',$this->db->escape_str($id));
        return $this->db->get($this->_table)->row_array();
	}

    public function showListProduct(){
        $this->db->select('id, title, url');
        return $this->db->get($this->_table)->result_array();
    }

    public function showProduct($limit = 0){
    	$this->db->select('id, title, url, price_new, thumb');
    	if($limit != 0){
    		$this->db->limit($limit);
    		$this->db->order_by('id','random');
    	}
        return $this->db->get($this->_table)->result_array();
    }

    
}